<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"  
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3">  
    <head>  
        <title>修改用户</title>  
        <script src="/scripts/boot.js"></script>
    </head>  
    <body class="bg-white"> 
  		<div id="editForm" style="height:100%;overflow-y:auto;">
			<table class="table-default" style="width:70%;table-layout:fixed; margin: 0 auto;" border="0" align="center" cellspacing="1" cellpadding="1">
				<colgroup>
			        <col width="80px"></col>
			        <col width="100%"></col>
					<!-- <col width="80px"></col>
					<col width="50%"></col> -->
			    </colgroup>
				<tr>
			        <td class="text-title noEmpty">名称</td>
			        <td>
			        	<input name="name" class="mini-textbox w250"  required="true" vtype="maxLength:48" errorMode="none" onvalidation="onNullValidation" requiredErrorText="请输入"/>
			        </td>
			    </tr>
			    <tr>
			        <td class="text-title noEmpty">值</td>
			        <td>
			            <input type="hidden" class="mini-hidden" name="id"/>
			        	<input name="value" class="mini-textbox w250" required="true" vtype="maxLength:48" errorMode="none" onvalidation="onNullValidation" requiredErrorText="请输入"/>
			        </td>
			    </tr>
			 
			</table>
			<div class="mini-fit"></div> 
			<div class="chose-toolbar">
		        <a class="chose-button" onclick="CloseWindow('close')">取消</a>
		        <a class="chose-button save-button" onclick="save()">保存</a>
		    </div>
		</div>
		<script type="text/javascript">
		   	mini.parse();
			var form = new mini.Form("#editForm");
			 function SetData(data) {
                //跨页面传递的数据对象，克隆后才可以安全使用
                data = mini.clone(data);
                $.ajax({
                    url: "/dictionary/info?id=" + data.id,
                    cache: false,
                    success: function (text) {
                        var o = mini.decode(text);
                        form.setData(o);
                        form.setChanged(false);
                        mini.getbyName("position").setValue(o.position);
                    }
                });
		    }
			 //保存
			function save(){
				form.validate();
	            if (form.isValid() == false) return;
	            var data = form.getData();      //获取表单多个控件的数据
	            $.ajax({
					type : "post",
					url : "/dictionary/edit",
					data : data,
					success : function(msg) {
						CloseWindow("ok")
					}
				});
			}
			 
			 //关闭窗口
		    function CloseWindow(action) {
		        if (window.CloseOwnerWindow) return window.CloseOwnerWindow(action);
		        else window.close();
		    }
			
		</script>
    </body>  
</html>  